import requests
import time

test = """
エイジングケアサポートが期待出来るパセリシードやグレープシードエキスを主成分に、アロエベラ・カモミールオイルが肌をなめらかに整える美容液です。エイジングケア・保湿・肌を整える3つのパワーで弾力のあるみずみずしい肌に導きます。浸透の早いシリコンフリーセラムです。
"""


def index(content):
    headers = {
        "content-type": "application/json"
    }
    url = 'https://www2.deepl.com/jsonrpc'
    data = {"jsonrpc": "2.0", "method": "LMT_handle_jobs", "params": {"jobs": [
        {"kind": "default", "raw_en_sentence": content, "raw_en_context_before": [],
         "raw_en_context_after": [], "preferred_num_beams": 4}], "lang": {"user_preferred_langs": ["ZH", "EN", "JA"],
                                                                          "source_lang_user_selected": "auto",
                                                                          "target_lang": "ZH"}, "priority": 1,
        "commonJobParams": {"formality": None},
        "timestamp": int(round(time.time() * 1000))}, "id": None}
    data = requests.post(url, json=data, headers=headers).json()
    print(data['result']['translations'][0]['beams'][0]['postprocessed_sentence'])


import xpinyin

if __name__ == '__main__':
    p = xpinyin.Pinyin()
    result = [p.get_initials(a, '') for a in ['上海']][0]
    print(result)

# if __name__ == '__main__':
#     index(test)
